package com.ruoyi.flow.common.utils;

import javax.servlet.http.HttpServletRequest;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * WEB请求工具类
 */
public class RequestUtils {
    /**
     * 判断一个请求是否是Ajax请求
     *
     * @param request
     * @return
     */
    public static boolean isAjaxRequest(HttpServletRequest request) {
        checkNotNull(request);
        return "XMLHttpRequest".equals(request.getHeader("X-Requested-With"));
    }
}
